﻿using FigureDraw.Diagram;
using FigureDraw.Graphic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FigureDraw.Shapes.DataFlowShape
{
    class MoveDataFlow : MyShape
    {
        double x2;
        double y2;

        public MoveDataFlow(double x1, double y1, double x2, double y2)
            : base(x1, y1)
        {
            this.x2 = x2;
            this.y2 = y2;
        }

        public override void Draw(CommonGraphic graphic)
        {
            graphic.DrawArc((float)x, (float)y, (float)Math.Abs(x - x2), (float)Math.Abs(y - y2), 180, 180);

            //double arrowDegrees = 0.5;
            //double arrowLength = 15;
            
            //double angle = Math.Atan2(y2 - y, x2 - x) + Math.PI;

            //double arrowX1 = x2 + arrowLength * Math.Cos(angle - arrowDegrees);
            //double arrowY1 = y2 + arrowLength * Math.Sin(angle - arrowDegrees);
            //double arrowX2 = x2 + arrowLength * Math.Cos(angle + arrowDegrees);
            //double arrowY2 = y2 + arrowLength * Math.Sin(angle + arrowDegrees);

            ////graphic.DrawLine(x, y, x2, y2);
            //graphic.DrawLine(arrowX1, arrowY1, x2, y2);
            //graphic.DrawLine(arrowX2, arrowY2, x2, y2);
        }

        public override MyShape Clone(BlockDiagram diagram)
        {
            return diagram.DrawMove(x, y, x2, y2);
        }
    }
}
